﻿Namespace Solution

    Public Class SolutionVO
        Inherits BaseVO

        Private _solutionId As Integer
        'Private _code As String
        Private _name As String
        Private _description As String
        Private _deleted As Boolean

        Private _projects As New Generic.List(Of ProjectVO)
        Private _userSolutions As New Generic.List(Of UserSolutionVO)

        Sub New()
        End Sub

        Sub New(entity As Data.BaseModel.Solution)
            If entity IsNot Nothing Then
                solutionId = entity.SolutionId
                name = entity.Name
                description = entity.Description
                deleted = entity.Deleted

                If entity.Projects IsNot Nothing Then
                    For Each oItem As Data.BaseModel.Project In entity.Projects
                        projects.Add(New ProjectVO(oItem))
                    Next
                End If

            End If
        End Sub

        Public Property solutionId As Integer
            Get
                Return _solutionId
            End Get
            Set(value As Integer)
                _solutionId = value
            End Set
        End Property

        <RequiredAtt("name")> _
        Public Property name As String
            Get
                Return _name
            End Get
            Set(value As String)
                _name = value
            End Set
        End Property

        Public Property description As String
            Get
                Return _description
            End Get
            Set(value As String)
                _description = value
            End Set
        End Property

        Public Property deleted As Boolean
            Get
                Return _deleted
            End Get
            Set(ByVal value As Boolean)
                _deleted = value
            End Set
        End Property

        Public Property projects As Generic.List(Of ProjectVO)
            Get
                Return _projects
            End Get
            Set(ByVal value As Generic.List(Of ProjectVO))
                _projects = value
            End Set
        End Property
        Public Property userSolutions As Generic.List(Of UserSolutionVO)
            Get
                Return _userSolutions
            End Get
            Set(ByVal value As Generic.List(Of UserSolutionVO))
                _userSolutions = value
            End Set
        End Property

    End Class

End Namespace